import { dump } from "./dump.js";
import { parse } from "./templateParse.js";
import { transformJavaScriptAST } from "./transformJavaScriptAST.js";
import { generate } from "./generate.js";

function compiler() {
  /* 将模板解析为模板AST */
  const AST = parse("<div><p>Vue</p></div>");
  console.log("🚀 ~ templateASTDesc ====> ", AST);

  /* 访问打印模板AST树的节点 */
  dump(AST);

  /* 模板AST 转换成 javascript AST */
  transformJavaScriptAST(AST);

  console.log("🚀 ~ templateASTDesc ====> ", AST);

  const code = generate(AST.jsNode);
  console.log("🚀 ~ compiler ~ code ====> ", code);
  return code;
}

compiler();
